package com.yitao.cms.constant;

import java.util.HashMap;
import java.util.Map;

public class BaseEnum {

    /**
     * 是 1  否 0
     */
    public enum YesOrNoEnum {

        NO(0, "否"),
        YES(1, "是");

        private static final Map<Integer, YesOrNoEnum> map = new HashMap<>();

        static {
            YesOrNoEnum[] values = YesOrNoEnum.values();
            for (YesOrNoEnum yesOrNoEnum : values) {
                map.put(yesOrNoEnum.code, yesOrNoEnum);
            }
        }

        private final Integer code;
        private final String name;

        private YesOrNoEnum(Integer code, String name) {
            this.code = code;
            this.name = name;
        }

        public static YesOrNoEnum getEnum(Integer code) {
            return map.get(code);
        }

        public Integer getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }


}
